
<?php
include('conn.php');
$account=$_REQUEST['account'];//用中括号
$pwd=$_REQUEST['pwd'];
$sql="select * from reg where phone='$account' and pwd='$pwd'";

$res=$mysqli->query($sql);

if($res->num_rows>0){//.对象属性不用$
    echo "<script>alert('登录成功')</script>";
    echo "<script src=\"../js/cookie.js\"></script>";
    echo "<script>cookie.set('isLogin',true,1);cookie.set('user','$account',1);</script>";//记录信息
    echo "<script>location.href='../html/index1.html'</script>";
}else{
    echo "<script>alert('用户名或密码错误')</script>";
    echo "<script>location.href='../html/login.html'</script>";
};
$mysqli->close();
?>